package com.arrogames.blondbattle.game.movement
{
	import flash.geom.Point;
	
	public class Position
	{
		public var position : Point;
		public var rotation : Number = 0;
		public var distanceTraveled:Point;
		
		public function Position( x : Number, y : Number, rotation : Number )
		{
			position = new Point( x, y );
			distanceTraveled = new Point(0,0);
			this.rotation = rotation;
		}
		
		public function updatePosition(diffX:Number, diffY:Number) : void 
		{
			position.x += diffX;
			position.y += diffY;
			distanceTraveled.x += diffX;
			distanceTraveled.y += diffY;
		}
		
		/**
		 * Calculate the difference traveled
		 * 
		 * @return	Number
		 */
		public function getDistanceTraveled() : Number
		{
			return Math.sqrt(Math.pow(distanceTraveled.x, 2) + Math.pow(distanceTraveled.y, 2));
		}
	}
}
